package com.esgpro.esg_api.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
@MapperScan("com.esgpro.esg_api.mapper")
public class MyBatisPlusConfig {
    /**
     * //配置分页插件(过时了！！！)
     * // 可以用，但是可以total的值会一直显示为0
     *
     *  public PaginationInnerInterceptor paginationInnerInterceptor() {
     * return new PaginationInnerInterceptor();
     * }
     */

    // 新版本的方法就是  MybatisPlusInterceptor
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
        return interceptor;
    }


}
